<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('代理商还款明细列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label style="width: 110px;">扣款代理商编号：</label>
                                <input type="text" name="agentNumK"/>
                            </li>
                            <li>
                                <label style="width: 110px;">扣款代理商名称：</label>
                                <input type="text" name="agentNameK"/>
                            </li>
                            <li>
                                <label style="width: 110px;">扣款序号：</label>
                                <input type="text" name="adId"/>
                            </li>
                            <li>
                                <label style="width: 110px;">扣款来源编号：</label>
                                <input type="text" name="settleIdK"/>
                            </li>
                            <li>
                                <label style="width: 110px;">返款去向编号：</label>
                                <input type="text" name="settleIdF"/>
                            </li>


                            <li>
                                <label style="width: 110px;">激活类型：</label>
                                <select id="deductionType" name="deductionType" class="form-control noselect2 selectpicker" th:with="type=${@dict.getType('deductionType')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label style="width: 110px;">终端类型：</label>
                                <select id="posType" name="posType" class="form-control noselect2 selectpicker" th:with="type=${@dict.getType('terminal_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label style="width: 110px;">扣款日期：</label>
                                <input type="text" class="time-input" id="startTime" readonly placeholder="开始时间" name="start"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" readonly placeholder="结束时间" name="end"/>
                            </li>
                            <li>
                                <label style="width: 10px;"></label>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="finance:AgentDeductionsKf:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="finance:AgentDeductionsKf:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="finance:AgentDeductionsKf:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-success" onclick="exportExcel()" shiro:hasPermission="finance:AgentDeductionsKf:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" class="table text-nowrap"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var datas = [[${@dict.getType('deductionType')}]];
        var datas1 = [[${@dict.getType('terminal_type')}]];
        var editFlag = [[${@permission.hasPermi('finance:AgentDeductionsKf:edit')}]];
        var removeFlag = [[${@permission.hasPermi('finance:AgentDeductionsKf:remove')}]];
        var prefix = ctx + "finance/AgentDeductionsKf";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "代理商还款明细",
                firstLoad:false,
                clickToSelect:true,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'adId',
                    title: '扣款序号'
                },
                {
                    field: 'agentNumK',
                    title: '扣款代理商编号'
                },
                {
                    field: 'agentNameK',
                    title: '扣款代理商名称'
                },
                {
                    field: 'deductionMoneyAll',
                    title: '总扣款金额'
                },
                {
                    field: 'deductionMoneyBedo',
                    title: '剩余金额'
                },
                {
                    field: 'deductionMoney',
                    title: '当前扣款金额'
                },
                {
                    field: 'deductionMoneyNow',
                    title: '已扣金额'
                },
                {
                    field: 'createDate',
                    title: '扣款日期'
                },
                {
                    field: 'settleIdK',
                    title: '扣款来源编号'
                },
                {
                    field: 'settleIdF',
                    title: '返款去向编号'
                },
                {
                    field: 'profitType',
                    title: '结算类型',
                    formatter: function (value, row, index) {
                        if ("0"==value){
                            return '<span style="color:blue;">服务商直推分润</span>';
                        }else if("1"==value){
                            return '<span style="color:green;">团队分润</span>';
                        }else if("2"==value){
                            return '<span style="color:green;">引流奖励</span>';
                        }else if("3"==value){
                            return '<span style="color:#0f4c0f;">达标返现</span>';
                        }else if("4"==value){
                            return '<span style="color:#0f4c0f;">二段达标</span>';
                        }else if("5"==value){
                            return '<span style="color:#0f4c0f;">三段达标</span>';
                        }else if("6"==value){
                            return '<span style="color:#0f4c0f;">提现奖励</span>';
                        }else if("7"==value){
                            return '<span style="color:#0f4c0f;">交易增量分润</span>';
                        }else if("8"==value){
                            return '<span style="color:#0f4c0f;">累计采购分润</span>';
                        }else if("11"==value){
                            return '<span style="color:#0f4c0f;">自采购奖励</span>';
                        }else if("12"==value){
                            return '<span style="color:#0f4c0f;">团员采购奖励</span>';
                        }else if (value == '14'){
                            return '<span style="color: #006dcc">引流人员奖励政策</span>';
                        }else if (value == '15'){
                            return '<span style="color: #006dcc">引流人员入团补差</span>';
                        }else if (value == '16') {
                            return '<span style="color: #006dcc">累计采购奖励政策</span>';
                        }else if (value == '17') {
                            return '<span style="color: #006dcc">团交易同比增量奖励</span>';
                        }else if (value == '18') {
                            return '<span style="color: #006dcc">交易量新增一千万返现</span>';
                        }else if (value == '19') {
                            return '<span style="color: #006dcc">雏鹰计划奖励</span>';
                        }else if (value == '20') {
                            return '<span style="color: #006dcc">210激团奖（团长引流奖励 A）</span>';
                        }else if (value == '21') {
                            return '<span style="color: #006dcc">传统引流奖励</span>';
                        }else if (value == '22') {
                            return '<span style="color: #006dcc">分润税奖励</span>';
                        }else if (value == '24') {
                            return '<span style="color: #006dcc">底薪计划</span>';
                        }else if (value == '25') {
                            return '<span style="color: #006dcc">通讯费分润</span>';
                        }else if (value == '26') {
                            return '<span style="color: #006dcc"> 机具尾款返现</span>';
                        }else if (value == '27') {
                            return '<span style="color: #006dcc"> 采购人奖励</span>';
                        }else {
                            return '<span style="color: #ff0000">未知</span>';
                        }
                    }
                },
                {
                    field: 'deductionType',
                    title: '激活类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'posType',
                    title: '终端类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(datas1, value);
                    }
                }
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function(value, row, index) {
                //         var actions = [];
                //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                //         return actions.join('');
                //     }
                // }
                ]
            };
            $.table.init(options);
        });
        // 导出数据
        function exportExcel(formId) {
            table.set();
            $.modal.confirm("确定导出代理商扣款明细吗？", function() {
                var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId;
                var params = $("#" + table.options.id).bootstrapTable('getOptions');
                var dataParam = $("#" + currentId).serializeArray();
                dataParam.push({ "name": "orderByColumn", "value": params.sortName });
                dataParam.push({ "name": "isAsc", "value": params.sortOrder });
                $.modal.loading("正在导出数据，请稍后...");
                $.post(table.options.exportUrl, dataParam, function(result) {
                    if (result.code == web_status.SUCCESS) {
                        $.modal.alertSuccess(result.msg);
                    } else if (result.code == web_status.WARNING) {
                        $.modal.alertWarning(result.msg)
                    } else {
                        $.modal.alertError(result.msg);
                    }
                    $.modal.closeLoading();
                });
            });

        }
    </script>
</body>
</html>
